import React from 'react'
import PropTypes from 'prop-types'
import { Modal, Form, Input } from 'antd'
const FormItem = Form.Item


const modal = ({
  onOk,
  form: {
    getFieldDecorator,
    validateFields,
    getFieldsValue,
  },
  ...modalProps
}) => {

  const handleOk = () => {
    const fields = getFieldsValue()
    const { password } = fields
    onOk({ password })
  }

  return (
    <Modal {...modalProps} onOk={handleOk}>
      <FormItem>
        {getFieldDecorator('password')(<Input type="password" />)}
      </FormItem>
    </Modal>
  )
}


export default Form.create()(modal)
